﻿using System;
using System.Collections.Generic;
using System.Text;
using Core.Graphics.Animations;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Core.Graphics.Tiles
{
    public class AnimatedTile : Tile
    {
        public override TileID SpriteID { get { return _TileAnimation.CurrentFrame.FrameTile.SpriteID; } set { _TileAnimation.CurrentFrame.FrameTile.SpriteID = value; } }
        public override Color DrawColor { get { return _TileAnimation.CurrentFrame.FrameTile.DrawColor; } set { _TileAnimation.CurrentFrame.FrameTile.DrawColor = value; } }

        public override TileSetTile TileSetTile { get { return _TileAnimation.CurrentFrame.FrameTile.TileSetTile; } set { _TileAnimation.CurrentFrame.FrameTile.TileSetTile = value; } }

        public Animation TileAnimation { get { return _TileAnimation; } set { _TileAnimation = value; } }

        protected Animation _TileAnimation;

        public AnimatedTile(int FirstFrame, int FirstShownFrame, float AnimationDelay, AnimationTypes AnimationType)
        {
            _TileAnimation = new Animation(FirstFrame, FirstShownFrame, AnimationDelay, AnimationType);
        }

        public AnimatedTile()
        {
            _TileAnimation = new Animation();
        }

        public override void Draw(SpriteBatch SpriteBatch, Rectangle Destination)
        {
            _TileAnimation.CurrentFrame.Draw(SpriteBatch, Destination);
        }

        public virtual void Update(float TimeElapsed)
        {
            TileAnimation.Update(TimeElapsed);
        }
    }
}
